package jpavlich.cardsorter.action;

import fr.inria.zvtm.engine.Camera;
import fr.inria.zvtm.engine.View;

public class ZoomToFit extends MoveCamera {

	private float mFactor;

	public ZoomToFit(float mFactor, int duration, View view, Camera camera) {
		super(new SerializableLocation(view.getGlobalView(camera, mFactor)), duration, view, camera);
		this.mFactor = mFactor;
	}

	@Override
	void execute() {
		View view = (View) getResourceManager().findResource(viewID);
		to = new SerializableLocation(view.getGlobalView((Camera) getResourceManager().findResource(cameraID), mFactor));
		moveCameraTo(to);
	}

	@Override
	public MoveCamera clone() {
		return new ZoomToFit(mFactor, duration, (View) getResourceManager().findResource(viewID), (Camera) getResourceManager().findResource(cameraID));
	}

	
}
